# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'soal.ui'
#
# Created: Tue May 03 13:02:37 2011
#      by        : PyQt4 UI code generator 4.7 
#      edited by : licface <licface@yahoo.com>
#
# WARNING! All changes made in this file will be lost!

#import controller
#import library
#import v_login
import os
import sys
import library
import error
import traceback
import view
import  v_login

from PyQt4 import QtCore, QtGui

class vsoal(QtGui.QMainWindow):
    closed = QtCore.pyqtSignal()

    def __init__(self,parent=None):
        super(vsoal,self).__init__(parent)
        self.parent = parent
        self.jwb_benar = " "
        myclass_soal = library.l_soal()
        myclass_soal.delete_navsoal()
        self.comboControll = True
        self.backControll = True

        if os.getcwd() != os.path.split(sys.argv[0])[0]:
            if "view" in os.path.split(sys.argv[0])[0]:
                os.chdir("..\\")
                self.mypath = os.path.split(sys.argv[0])[0] + "/images/"
            else:
                if "system" in os.path.split(sys.argv[0])[0]:
                    self.mypath = os.path.split(sys.argv[0])[0] + "/images/"
                else:
                    self.mypath = os.path.split(sys.argv[0])[0] + "/system/images/"
        else:
            if "system" in os.getcwd():
                if "view" in os.getcwd():
                    os.chdir("..\\")
                    self.mypath = os.path.split(sys.argv[0])[0] + '/images/' 
                else:
                    self.mypath = os.path.split(sys.argv[0])[0] + '/images/' 
            else:
                self.mypath = os.path.split(sys.argv[0])[0] + "/system/images/"
        print "v_soal - __init__ --> mypath = ", self.mypath
        error.sendlog(['info',"v_soal - __init__ --> mypath = " + str(self.mypath)])


    #def setupUi(self, MainWindow):
        self.setObjectName("MainWindow")
        self.setEnabled(True)
        self.resize(480, 624)
        self.setGeometry(300,50,480,700)
        self.setFixedSize(480, 700)
        
        self.head_group = QtGui.QGroupBox(self)
        self.head_group.setGeometry(QtCore.QRect(10, 25, 460, 150))
        
        self.t_edit = QtGui.QTextEdit(self.head_group)
        self.t_edit.setGeometry(QtCore.QRect(90, 20, 363, 91))
        self.t_edit.setObjectName("t_edit")
        self.l_s = QtGui.QLabel(self)
        self.l_s.setGeometry(QtCore.QRect(20, 50, 61, 21))
        self.l_s.setObjectName("l_s")

        self.l_type_soal = QtGui.QLabel(self.head_group)
        self.l_type_soal.setGeometry(QtCore.QRect(10, 110, 90, 41))
        self.l_type_soal.setObjectName("l_type_soal")
        
        self.wid_type_soal = QtGui.QWidget(self.head_group)
        self.wid_type_soal.setGeometry(QtCore.QRect(120, 110, 132, 41))
        self.type_soal_pg = QtGui.QCheckBox(self.wid_type_soal)
        self.type_soal_pg.setObjectName("type_soal_pg")
        self.type_soal_pg.connect(self.type_soal_pg, QtCore.SIGNAL("clicked()"), self.chekbox_state_type_soal_1)
        self.type_soal_essay = QtGui.QCheckBox(self.wid_type_soal)
        self.type_soal_essay.setObjectName("type_soal_essay")
        self.type_soal_essay.connect(self.type_soal_essay, QtCore.SIGNAL("clicked()"), self.chekbox_state_type_soal_2)
        self.hl_type_soal = QtGui.QHBoxLayout(self.wid_type_soal)
        self.hl_type_soal.setObjectName("hl_type_soal")
        self.hl_type_soal.addWidget(self.type_soal_pg)
        self.hl_type_soal.addWidget(self.type_soal_essay)
        
        self.l_nosoal = QtGui.QLabel(self.head_group)
        self.l_nosoal.setGeometry(QtCore.QRect(300,110,50,41))
        self.l_nosoal.setText("SOAL No : ")
        self.c_nosoal = QtGui.QComboBox(self.head_group)
        self.c_nosoal.setGeometry(QtCore.QRect(370,115,80,25))
        self.c_nosoal.setObjectName("c_nosoal2")
        self.c_nosoal.addItem(" ") 
        self.c_nosoal.setFont(QtGui.QFont("Arial",11, 600))
        
        #widget #1
        self.centralwidget = QtGui.QGroupBox(self)
        self.centralwidget.setObjectName("centralwidget")
        self.centralwidget.setGeometry(QtCore.QRect(10,180,460,500))
        
        #widget #2
        self.centralwidget2 = QtGui.QGroupBox(self.centralwidget)
        self.centralwidget2.setObjectName("centralwidget2")
        self.centralwidget2.setGeometry(QtCore.QRect(3,3,454,494))
        
        self.l_jp = QtGui.QLabel(self.centralwidget2)
        self.l_jp.setGeometry(QtCore.QRect(30, 10, 151, 16))
        self.l_jp.setObjectName("l_jp")
        
        self.l_a = QtGui.QLabel(self.centralwidget2)
        self.l_a.setGeometry(QtCore.QRect(30, 40, 21, 16))
        self.l_a.setObjectName("l_a")
        self.l_b = QtGui.QLabel(self.centralwidget2)
        self.l_b.setGeometry(QtCore.QRect(30, 100, 21, 16))
        self.l_b.setObjectName("l_b")
        self.l_c = QtGui.QLabel(self.centralwidget2)
        self.l_c.setGeometry(QtCore.QRect(30, 160, 21, 16))
        self.l_c.setObjectName("l_c")
        self.l_d = QtGui.QLabel(self.centralwidget2)
        self.l_d.setGeometry(QtCore.QRect(30, 220, 21, 16))
        self.l_d.hide()
        self.l_d.setObjectName("l_d")
        self.l_e = QtGui.QLabel(self.centralwidget2)
        self.l_e.setGeometry(QtCore.QRect(30, 280, 21, 20))
        self.l_e.hide()
        self.l_e.setObjectName("l_e")
        self.l_f = QtGui.QLabel(self.centralwidget2)
        self.l_f.setGeometry(QtCore.QRect(30, 340, 21, 16))
        self.l_f.hide()
        self.l_f.setObjectName("l_f")
        
        self.l_benar = QtGui.QLabel(self.centralwidget2)
        self.l_benar.setGeometry(QtCore.QRect(30, 210, 145, 51))
        self.l_benar.setObjectName("l_benar")
        
        self.j_a = QtGui.QTextEdit(self.centralwidget2)
        self.j_a.setGeometry(QtCore.QRect(60, 40, 385, 51))
        self.j_a.setObjectName("j_a")
        self.j_b = QtGui.QTextEdit(self.centralwidget2)
        self.j_b.setGeometry(QtCore.QRect(60, 100, 385, 51))
        self.j_b.setObjectName("j_b")
        self.j_c = QtGui.QTextEdit(self.centralwidget2)
        self.j_c.setGeometry(QtCore.QRect(60, 160, 385, 51))
        self.j_c.setObjectName("j_c")
        self.j_d = QtGui.QTextEdit(self.centralwidget2)
        self.j_d.setGeometry(QtCore.QRect(60, 220, 385, 51))
        self.j_d.hide()
        self.j_d.setObjectName("j_d")
        self.j_e = QtGui.QTextEdit(self.centralwidget2)
        self.j_e.setGeometry(QtCore.QRect(60, 280, 385, 51))
        self.j_e.hide()
        self.j_e.setObjectName("j_e")
        self.j_f = QtGui.QTextEdit(self.centralwidget2)
        self.j_f.setGeometry(QtCore.QRect(60, 340, 385, 51))
        self.j_f.hide()
        self.j_f.setObjectName("j_f")

        self.widget_lbenar = QtGui.QWidget(self.centralwidget2)
        self.widget_lbenar.setGeometry(QtCore.QRect(176, 215, 200, 41))
        self.widget_lbenar.setObjectName("widget_lbenar")
        self.horizontalLayout_lbenar = QtGui.QHBoxLayout(self.widget_lbenar)
        self.horizontalLayout_lbenar.setObjectName("horizontalLayout_lbenar")

        self.lbenar_a = QtGui.QRadioButton(self.widget_lbenar)
        self.lbenar_a.setText("A")
        self.lbenar_a.setObjectName("radio_lbenar_a")
        self.horizontalLayout_lbenar.addWidget(self.lbenar_a)
        self.lbenar_a.connect(self.lbenar_a, QtCore.SIGNAL("clicked()"), self.set_jwb_benar)

        self.lbenar_b = QtGui.QRadioButton(self.widget_lbenar)
        self.lbenar_b.setObjectName("radio_lbenar_b")
        self.horizontalLayout_lbenar.addWidget(self.lbenar_b)
        self.lbenar_b.connect(self.lbenar_b, QtCore.SIGNAL("clicked()"), self.set_jwb_benar)

        self.lbenar_c = QtGui.QRadioButton(self.widget_lbenar)
        self.lbenar_c.setObjectName("radio_lbenar_c")
        self.horizontalLayout_lbenar.addWidget(self.lbenar_c)
        self.lbenar_c.connect(self.lbenar_c, QtCore.SIGNAL("clicked()"), self.set_jwb_benar)

        self.lbenar_d = QtGui.QRadioButton(self.widget_lbenar)
        self.lbenar_d.setObjectName("radio_lbenar_d")
        self.horizontalLayout_lbenar.addWidget(self.lbenar_d)
        self.lbenar_d.connect(self.lbenar_d, QtCore.SIGNAL("clicked()"), self.set_jwb_benar)
        self.lbenar_d.hide()

        self.lbenar_e = QtGui.QRadioButton(self.widget_lbenar)
        self.lbenar_e.setObjectName("radio_lbenar_e")
        self.horizontalLayout_lbenar.addWidget(self.lbenar_e)
        self.lbenar_e.connect(self.lbenar_e, QtCore.SIGNAL("clicked()"), self.set_jwb_benar)
        self.lbenar_e.hide()

        self.lbenar_f = QtGui.QRadioButton(self.widget_lbenar)
        self.lbenar_f.setObjectName("radio_lbenar_f")
        self.horizontalLayout_lbenar.addWidget(self.lbenar_f)
        self.lbenar_f.connect(self.lbenar_f, QtCore.SIGNAL("clicked()"), self.set_jwb_benar)
        self.lbenar_f.hide()

        self.next_bt = QtGui.QPushButton(self.centralwidget2)
        self.next_bt.setGeometry(QtCore.QRect(350, 445, 91, 31))
        self.next_bt.setObjectName("next_bt")
        self.next_bt.setIcon(QtGui.QIcon(self.mypath + "menu\\next.png"))
        self.next_bt.connect(self.next_bt, QtCore.SIGNAL("clicked()"), self.next_process_gateway)

        self.edit_bt = QtGui.QPushButton(self.centralwidget2)
        self.edit_bt.setGeometry(QtCore.QRect(185, 445, 91, 31))
        self.edit_bt.setObjectName("edit_bt")
        self.edit_bt.setIcon(QtGui.QIcon(self.mypath + "menu\\edit2.png"))
        self.edit_bt.connect(self.edit_bt, QtCore.SIGNAL("clicked()"), self.enable_edit)
        self.edit_bt.hide()

        self.save_bt = QtGui.QPushButton(self.centralwidget2)
        self.save_bt.setGeometry(QtCore.QRect(350, 445, 91, 31))
        self.save_bt.setObjectName("edit_bt")
        self.save_bt.setIcon(QtGui.QIcon(self.mypath + "menu\\save.png"))
        self.save_bt.hide()

        self.cancel_bt = QtGui.QPushButton(self.centralwidget2)
        self.cancel_bt.setGeometry(QtCore.QRect(10, 445, 91, 31))
        self.cancel_bt.setObjectName("back_bt")
        self.cancel_bt.setIcon(QtGui.QIcon(self.mypath + "menu\\cancel.png"))
        self.cancel_bt.hide()

        self.back_bt = QtGui.QPushButton(self.centralwidget2)
        self.back_bt.setGeometry(QtCore.QRect(10, 445, 91, 31))
        self.back_bt.setObjectName("back_bt")
        self.back_bt.setIcon(QtGui.QIcon(self.mypath + "menu\\back.png"))
        self.back_bt.connect(self.back_bt, QtCore.SIGNAL("clicked()"), self.back_process)

        self.widget = QtGui.QWidget(self.centralwidget2)
        self.widget.setGeometry(QtCore.QRect(160,0, 132, 41))
        self.widget.setObjectName("widget")
        self.horizontalLayout = QtGui.QHBoxLayout(self.widget)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.checkBox = QtGui.QCheckBox(self.widget)
        self.checkBox.setObjectName("checkBox")
        self.checkBox.connect(self.checkBox, QtCore.SIGNAL("clicked()"), self.chekbox_state1)
        self.horizontalLayout.addWidget(self.checkBox)
        self.checkBox_2 = QtGui.QCheckBox(self.widget)
        self.checkBox_2.setObjectName("checkBox_2")
        self.checkBox_2.connect(self.checkBox_2, QtCore.SIGNAL("clicked()"), self.chekbox_state2)
        self.horizontalLayout.addWidget(self.checkBox_2)
        self.checkBox_3 = QtGui.QCheckBox(self.widget)
        self.checkBox_3.setObjectName("checkBox_3")
        self.checkBox_3.connect(self.checkBox_3, QtCore.SIGNAL("clicked()"), self.chekbox_state3)
        self.horizontalLayout.addWidget(self.checkBox_3)
        self.checkBox_4 = QtGui.QCheckBox(self.widget)
        self.checkBox_4.setObjectName("checkBox_4")
        self.checkBox_4.connect(self.checkBox_4, QtCore.SIGNAL("clicked()"), self.chekbox_state4)
        self.horizontalLayout.addWidget(self.checkBox_4)
        
        #Widget #3
        self.centralwidget3 = QtGui.QGroupBox(self.centralwidget)
        self.centralwidget3.setObjectName("centralwidget3")
        self.centralwidget3.setGeometry(QtCore.QRect(3,3,454,494))
        self.centralwidget3.hide()
        
        self.l_essay = QtGui.QLabel(self.centralwidget3)
        self.l_essay.setGeometry(QtCore.QRect(30, 20, 48, 16))
        self.l_essay.setObjectName("l_essay")

        self.j_essay = QtGui.QTextEdit(self.centralwidget3)
        self.j_essay.setGeometry(QtCore.QRect(90, 10, 355, 81))
        self.j_essay.setObjectName("j_essay")

        self.l_jessay = QtGui.QLabel(self.centralwidget3)
        self.l_jessay.setGeometry(QtCore.QRect(10, 100, 68, 16))
        self.l_jessay.setObjectName("l_jessay")

        self.j_jessay = QtGui.QTextEdit(self.centralwidget3)
        self.j_jessay.setGeometry(QtCore.QRect(90, 110, 355, 81))
        self.j_jessay.setObjectName("j_jessay")
        
        self.next_bt2 = QtGui.QPushButton(self.centralwidget3)
        self.next_bt2.setGeometry(QtCore.QRect(350, 445, 91, 31))
        self.next_bt2.setObjectName("next_bt")
        self.next_bt2.setIcon(QtGui.QIcon(self.mypath + "menu\\next.png"))
        self.next_bt2.connect(self.next_bt, QtCore.SIGNAL("clicked()"), self.next_process_gateway)

        self.edit_bt2 = QtGui.QPushButton(self.centralwidget3)
        self.edit_bt2.setGeometry(QtCore.QRect(185, 445, 91, 31))
        self.edit_bt2.setObjectName("edit_bt")
        self.edit_bt2.setIcon(QtGui.QIcon(self.mypath + "menu\\edit2.png"))
        self.edit_bt2.connect(self.edit_bt, QtCore.SIGNAL("clicked()"), self.enable_edit)
        self.edit_bt2.hide()

        self.save_bt2 = QtGui.QPushButton(self.centralwidget3)
        self.save_bt2.setGeometry(QtCore.QRect(350, 445, 91, 31))
        self.save_bt2.setObjectName("edit_bt")
        self.save_bt2.setIcon(QtGui.QIcon(self.mypath + "menu\\save.png"))
        self.save_bt2.hide()

        self.cancel_bt2 = QtGui.QPushButton(self.centralwidget3)
        self.cancel_bt2.setGeometry(QtCore.QRect(10, 445, 91, 31))
        self.cancel_bt2.setObjectName("back_bt")
        self.cancel_bt2.setIcon(QtGui.QIcon(self.mypath + "menu\\cancel.png"))
        self.cancel_bt2.hide()

        self.back_bt2 = QtGui.QPushButton(self.centralwidget3)
        self.back_bt2.setGeometry(QtCore.QRect(10, 445, 91, 31))
        self.back_bt2.setObjectName("back_bt")
        self.back_bt2.setIcon(QtGui.QIcon(self.mypath + "menu\\back.png"))
        self.back_bt2.connect(self.back_bt, QtCore.SIGNAL("clicked()"), self.back_process)
        
        """
        #self.setcentralwidget2(self.centralwidget2)

        #end for widget 3

        #self.setCentralWidget(self.centralwidget)
        
        """
        
        self.menubar = QtGui.QMenuBar(self)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 480, 20))
        self.menubar.setLayoutDirection(QtCore.Qt.RightToLeft)
        self.menubar.setObjectName("menubar")
        self.menuAbout = QtGui.QMenu(self.menubar)
        self.menuAbout.setObjectName("menuAbout")
        self.menuHelp = QtGui.QMenu(self.menubar)
        self.menuHelp.setObjectName("menuHelp")
        self.menuShow = QtGui.QMenu(self.menubar)
        self.menuShow.setObjectName("menuShow")
        self.menuEdit = QtGui.QMenu(self.menubar)
        self.menuEdit.setObjectName("menuEdit")
        self.menuFile = QtGui.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        self.setMenuBar(self.menubar)

        self.statusbar = QtGui.QStatusBar(self)
        self.statusbar.setObjectName("statusbar")
        self.setStatusBar(self.statusbar)

        self.actionAuthor = QtGui.QAction(self)
        self.actionAuthor.setObjectName("actionAuthor")
        self.actionAuthor.setIcon(QtGui.QIcon(self.mypath + "menu\\author.png"))
        self.actionHelp = QtGui.QAction(self)
        self.actionHelp.setObjectName("actionHelp")
        self.actionHelp.setIcon(QtGui.QIcon(self.mypath + "menu\\help.png"))
        self.actionSearch = QtGui.QAction(self)
        self.actionSearch.setObjectName("actionSearch")
        self.actionSearch.setIcon(QtGui.QIcon(self.mypath + "menu\\search.png"))
        self.actionLihat_semua_soal = QtGui.QAction(self)
        self.actionLihat_semua_soal.setObjectName("actionLihat_semua_soal")
        self.actionLihat_semua_soal.setIcon(QtGui.QIcon(self.mypath + "menu\\soal.png"))
        self.actionClose = QtGui.QAction(self)
        self.actionClose.setObjectName("actionClose")
        self.actionClose.setIcon(QtGui.QIcon(self.mypath + "menu\\close.png"))
        self.connect(self.actionClose, QtCore.SIGNAL("triggered()"), self.quit)
        self.actionEdit = QtGui.QAction(self)
        self.actionEdit.setObjectName("actionEdit")
        self.actionEdit.setIcon(QtGui.QIcon(self.mypath + "menu\\edit.png"))
        self.connect(self.actionEdit, QtCore.SIGNAL("triggered()"), self.enable_edit)
        self.actionConf = QtGui.QAction(self)
        self.actionConf.setObjectName("actionConf")
        self.actionConf.setIcon(QtGui.QIcon(self.mypath + "menu\\config.png"))
        self.connect(self.actionConf, QtCore.SIGNAL("triggered()"), self.win_conf)
        self.actionExport = QtGui.QAction(self)
        self.actionExport.setObjectName("actionExport")
        self.actionExport.setIcon(QtGui.QIcon(self.mypath + "menu\\export.png"))
        self.actionImport = QtGui.QAction(self)
        self.actionImport.setObjectName("actionImport")
        self.actionImport.setIcon(QtGui.QIcon(self.mypath + "menu\\import.png"))

        self.menuAbout.addAction(self.actionAuthor)
        self.menuHelp.addAction(self.actionHelp)
        self.menuShow.addAction(self.actionLihat_semua_soal)
        self.menuShow.addAction(self.actionSearch)
        self.menuEdit.addAction(self.actionEdit)
        self.menuEdit.addAction(self.actionConf)
        self.menuFile.addAction(self.actionExport)
        self.menuFile.addAction(self.actionImport)
        self.menuFile.addAction(self.actionClose)
        self.menubar.addAction(self.menuAbout.menuAction())
        self.menubar.addAction(self.menuHelp.menuAction())
        self.menubar.addAction(self.menuShow.menuAction())
        self.menubar.addAction(self.menuEdit.menuAction())
        self.menubar.addAction(self.menuFile.menuAction())
        
        self.retranslateUi()
        QtCore.QMetaObject.connectSlotsByName(self)

        self.setcenter()
        self.setWindowModality(True)
    
    def retranslateUi(self):
        self.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Soal", None, QtGui.QApplication.UnicodeUTF8))
        self.setToolTip(QtGui.QApplication.translate("MainWindow", "Soal Client", None, QtGui.QApplication.UnicodeUTF8))
        self.setStatusTip(QtGui.QApplication.translate("MainWindow", "soal client", None, QtGui.QApplication.UnicodeUTF8))
        self.setWhatsThis(QtGui.QApplication.translate("MainWindow", "ini adalah program untuk memasukkan soal  & jawaban", None, QtGui.QApplication.UnicodeUTF8))
        self.t_edit.setToolTip(QtGui.QApplication.translate("MainWindow", "Input Soal", None, QtGui.QApplication.UnicodeUTF8))
        self.t_edit.setFont(QtGui.QFont("Arial",12,300))
        self.t_edit.setStatusTip(QtGui.QApplication.translate("MainWindow", "Input Soal", None, QtGui.QApplication.UnicodeUTF8))
        self.t_edit.setWhatsThis(QtGui.QApplication.translate("MainWindow", "Input Soal", None, QtGui.QApplication.UnicodeUTF8))
        
        self.l_s.setText(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt; font-weight:600;\">SOAL :</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
        
        self.l_type_soal.setText(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:11pt; font-weight:600;\">Type Soal : </span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
        self.type_soal_pg.setText(QtGui.QApplication.translate("MainWindow", "PG", None, QtGui.QApplication.UnicodeUTF8))
        self.type_soal_essay.setText(QtGui.QApplication.translate("MainWindow", "Essay", None, QtGui.QApplication.UnicodeUTF8))
        
        self.l_jp.setText(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:11pt; font-weight:600;\">Jumlah Pilihan : </span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
        
        self.l_a.setText(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt; font-weight:600;\">a = </span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
        
        self.l_b.setText(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt; font-weight:600;\">b = </span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
        
        self.l_c.setText(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt; font-weight:600;\">c = </span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
        
        self.l_d.setText(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt; font-weight:600;\">d = </span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
        
        self.l_e.setText(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt; font-weight:600;\">e = </span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
        
        self.l_f.setText(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt; font-weight:600;\">f = </span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
        
        self.l_benar.setText(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt; font-weight:600;\">Jawaban yang benar : </span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) 
        
        self.l_essay.setText(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt; font-weight:600;\">Soal = </span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
        
        self.l_jessay.setText(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt; font-weight:600;\">Jawaban = </span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
        
        self.j_a.setToolTip(QtGui.QApplication.translate("MainWindow", "input jawaban a", None, QtGui.QApplication.UnicodeUTF8))
        self.j_a.setStatusTip(QtGui.QApplication.translate("MainWindow", "input jawaban a", None, QtGui.QApplication.UnicodeUTF8))
        self.j_a.setWhatsThis(QtGui.QApplication.translate("MainWindow", "input jawaban a", None, QtGui.QApplication.UnicodeUTF8))
        self.j_b.setToolTip(QtGui.QApplication.translate("MainWindow", "input jawaban b", None, QtGui.QApplication.UnicodeUTF8))
        self.j_b.setStatusTip(QtGui.QApplication.translate("MainWindow", "input jawaban b", None, QtGui.QApplication.UnicodeUTF8))
        self.j_b.setWhatsThis(QtGui.QApplication.translate("MainWindow", "input jawaban b", None, QtGui.QApplication.UnicodeUTF8))
        self.j_c.setToolTip(QtGui.QApplication.translate("MainWindow", "input jawaban c", None, QtGui.QApplication.UnicodeUTF8))
        self.j_c.setStatusTip(QtGui.QApplication.translate("MainWindow", "input jawaban c", None, QtGui.QApplication.UnicodeUTF8))
        self.j_c.setWhatsThis(QtGui.QApplication.translate("MainWindow", "input jawaban c", None, QtGui.QApplication.UnicodeUTF8))
        self.j_d.setToolTip(QtGui.QApplication.translate("MainWindow", "input jawaban d", None, QtGui.QApplication.UnicodeUTF8))
        self.j_d.setStatusTip(QtGui.QApplication.translate("MainWindow", "input jawaban d", None, QtGui.QApplication.UnicodeUTF8))
        self.j_d.setWhatsThis(QtGui.QApplication.translate("MainWindow", "input jawaban d", None, QtGui.QApplication.UnicodeUTF8))
        self.j_e.setToolTip(QtGui.QApplication.translate("MainWindow", "input jawaban e", None, QtGui.QApplication.UnicodeUTF8))
        self.j_e.setStatusTip(QtGui.QApplication.translate("MainWindow", "input jawaban e", None, QtGui.QApplication.UnicodeUTF8))
        self.j_e.setWhatsThis(QtGui.QApplication.translate("MainWindow", "input jawaban e", None, QtGui.QApplication.UnicodeUTF8))
        self.j_f.setToolTip(QtGui.QApplication.translate("MainWindow", "input jawaban f", None, QtGui.QApplication.UnicodeUTF8))
        self.j_f.setStatusTip(QtGui.QApplication.translate("MainWindow", "input jawaban f", None, QtGui.QApplication.UnicodeUTF8))
        self.j_f.setWhatsThis(QtGui.QApplication.translate("MainWindow", "input jawaban f", None, QtGui.QApplication.UnicodeUTF8))
        
        self.j_essay.setStatusTip(QtGui.QApplication.translate("MainWindow", "input soal essay", None, QtGui.QApplication.UnicodeUTF8))
        self.j_essay.setWhatsThis(QtGui.QApplication.translate("MainWindow", "input soal essay", None, QtGui.QApplication.UnicodeUTF8))
        self.j_jessay.setStatusTip(QtGui.QApplication.translate("MainWindow", "input jawaban essay", None, QtGui.QApplication.UnicodeUTF8))
        self.j_jessay.setWhatsThis(QtGui.QApplication.translate("MainWindow", "input jawaban essay", None, QtGui.QApplication.UnicodeUTF8))
        
        self.next_bt.setToolTip(QtGui.QApplication.translate("MainWindow", "soal berikutnya", None, QtGui.QApplication.UnicodeUTF8))
        self.next_bt.setStatusTip(QtGui.QApplication.translate("MainWindow", "soal berikutnya", None, QtGui.QApplication.UnicodeUTF8))
        self.next_bt.setWhatsThis(QtGui.QApplication.translate("MainWindow", "soal berikutnya", None, QtGui.QApplication.UnicodeUTF8))
        self.next_bt.setText(QtGui.QApplication.translate("MainWindow", "Next", None, QtGui.QApplication.UnicodeUTF8))
        self.back_bt.setToolTip(QtGui.QApplication.translate("MainWindow", "kembali ke halaman sebelumnya", None, QtGui.QApplication.UnicodeUTF8))
        self.back_bt.setStatusTip(QtGui.QApplication.translate("MainWindow", "kembali ke halaman sebelumnya", None, QtGui.QApplication.UnicodeUTF8))
        self.back_bt.setWhatsThis(QtGui.QApplication.translate("MainWindow", "kembali ke halaman sebelumnya", None, QtGui.QApplication.UnicodeUTF8))
        self.back_bt.setText(QtGui.QApplication.translate("MainWindow", "Back", None, QtGui.QApplication.UnicodeUTF8))
        self.edit_bt.setText(QtGui.QApplication.translate("MainWindow", "Edit", None, QtGui.QApplication.UnicodeUTF8))
        self.save_bt.setText(QtGui.QApplication.translate("MainWindow", "Save", None, QtGui.QApplication.UnicodeUTF8))
        self.cancel_bt.setText(QtGui.QApplication.translate("MainWindow", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
        self.checkBox.setText(QtGui.QApplication.translate("MainWindow", "3", None, QtGui.QApplication.UnicodeUTF8))
        self.checkBox_2.setText(QtGui.QApplication.translate("MainWindow", "4", None, QtGui.QApplication.UnicodeUTF8))
        self.checkBox_3.setText(QtGui.QApplication.translate("MainWindow", "5", None, QtGui.QApplication.UnicodeUTF8))
        self.checkBox_4.setText(QtGui.QApplication.translate("MainWindow", "6", None, QtGui.QApplication.UnicodeUTF8))
        
        self.next_bt2.setToolTip(QtGui.QApplication.translate("MainWindow", "soal berikutnya", None, QtGui.QApplication.UnicodeUTF8))
        self.next_bt2.setStatusTip(QtGui.QApplication.translate("MainWindow", "soal berikutnya", None, QtGui.QApplication.UnicodeUTF8))
        self.next_bt2.setWhatsThis(QtGui.QApplication.translate("MainWindow", "soal berikutnya", None, QtGui.QApplication.UnicodeUTF8))
        self.next_bt2.setText(QtGui.QApplication.translate("MainWindow", "Next", None, QtGui.QApplication.UnicodeUTF8))
        self.back_bt2.setToolTip(QtGui.QApplication.translate("MainWindow", "kembali ke halaman sebelumnya", None, QtGui.QApplication.UnicodeUTF8))
        self.back_bt2.setStatusTip(QtGui.QApplication.translate("MainWindow", "kembali ke halaman sebelumnya", None, QtGui.QApplication.UnicodeUTF8))
        self.back_bt2.setWhatsThis(QtGui.QApplication.translate("MainWindow", "kembali ke halaman sebelumnya", None, QtGui.QApplication.UnicodeUTF8))
        self.back_bt2.setText(QtGui.QApplication.translate("MainWindow", "Back", None, QtGui.QApplication.UnicodeUTF8))
        self.edit_bt2.setText(QtGui.QApplication.translate("MainWindow", "Edit", None, QtGui.QApplication.UnicodeUTF8))
        self.save_bt2.setText(QtGui.QApplication.translate("MainWindow", "Save", None, QtGui.QApplication.UnicodeUTF8))
        self.cancel_bt2.setText(QtGui.QApplication.translate("MainWindow", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
        
        self.lbenar_a.setText(QtGui.QApplication.translate("MainWindow", "A", None, QtGui.QApplication.UnicodeUTF8))
        self.lbenar_b.setText(QtGui.QApplication.translate("MainWindow", "B", None, QtGui.QApplication.UnicodeUTF8))
        self.lbenar_c.setText(QtGui.QApplication.translate("MainWindow", "C", None, QtGui.QApplication.UnicodeUTF8))
        self.lbenar_d.setText(QtGui.QApplication.translate("MainWindow", "D", None, QtGui.QApplication.UnicodeUTF8))
        self.lbenar_e.setText(QtGui.QApplication.translate("MainWindow", "E", None, QtGui.QApplication.UnicodeUTF8))
        self.lbenar_f.setText(QtGui.QApplication.translate("MainWindow", "F", None, QtGui.QApplication.UnicodeUTF8))
        self.setfont(self.j_a)
        self.setfont(self.j_b)
        self.setfont(self.j_c)
        self.setfont(self.j_e)
        self.setfont(self.j_f)

        self.c_nosoal.addItems(self.getallid('pg'))
        self.c_nosoal.connect(self.c_nosoal, QtCore.SIGNAL("activated(int)"), self.pre_getsoalby_id2)
        self.cancel_bt.connect(self.cancel_bt, QtCore.SIGNAL("clicked()"), self.cancel_edit)
        self.save_bt.connect(self.save_bt, QtCore.SIGNAL("clicked()"), self.updatesoal)

        #self.c_nosoal.connect(self.c_nosoal, QtCore.SIGNAL("currentIndexChanged(int)"), lambda: self.c_nosoal.addItems(self.getallid()))
        #self.c_nosoal.connect(self.c_nosoal, QtCore.SIGNAL("activated(int)"), lambda: self.getsoalby_id(self.c_nosoal.currentText()))
        #self.c_nosoal.connect(self.c_nosoal, QtCore.SIGNAL("currentIndexChanged(int)"), self.getsoalby_id2)
        
        #myclass = library.l_soal()
        #myclass.delete_navnosoal()
        #myclass.setnosoalmaxmin(1,0)
        #nosoal = myclass.getnosoalmaxmin()
        #print "v_soal - restranslateUi -> nosoal = ", nosoal
        #self.c_nosoal.clear()
        #self.c_nosoal.addItem(str(nosoal[1][0][0]))

        self.menuAbout.setTitle(QtGui.QApplication.translate("MainWindow", "About", None, QtGui.QApplication.UnicodeUTF8))
        self.menuHelp.setTitle(QtGui.QApplication.translate("MainWindow", "Help", None, QtGui.QApplication.UnicodeUTF8))
        self.menuShow.setTitle(QtGui.QApplication.translate("MainWindow", "Show", None, QtGui.QApplication.UnicodeUTF8))
        self.menuEdit.setTitle(QtGui.QApplication.translate("MainWindow", "Edit", None, QtGui.QApplication.UnicodeUTF8))
        self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", "File", None, QtGui.QApplication.UnicodeUTF8))
        self.actionAuthor.setText(QtGui.QApplication.translate("MainWindow", "Author", None, QtGui.QApplication.UnicodeUTF8))
        self.actionHelp.setText(QtGui.QApplication.translate("MainWindow", "Help", None, QtGui.QApplication.UnicodeUTF8))
        self.actionLihat_semua_soal.setText(QtGui.QApplication.translate("MainWindow", "Lihat semua soal", None, QtGui.QApplication.UnicodeUTF8))
        self.actionSearch.setText(QtGui.QApplication.translate("MainWindow", "Search", None, QtGui.QApplication.UnicodeUTF8))
        self.actionConf.setText(QtGui.QApplication.translate("MainWindow", "Setting", None, QtGui.QApplication.UnicodeUTF8))
        self.actionEdit.setText(QtGui.QApplication.translate("MainWindow", "Edit", None, QtGui.QApplication.UnicodeUTF8))
        self.actionExport.setText(QtGui.QApplication.translate("MainWindow", "Export", None, QtGui.QApplication.UnicodeUTF8))
        self.actionImport.setText(QtGui.QApplication.translate("MainWindow", "Import", None, QtGui.QApplication.UnicodeUTF8))
        self.actionClose.setText(QtGui.QApplication.translate("MainWindow", "Close", None, QtGui.QApplication.UnicodeUTF8))

    def setcenter(self):
        screen = QtGui.QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width() - self.width())/2, (screen.height() - self.height())/6)

    def closeEvent(self, event):
        error.sendlog(['debug','closeEvent --> Apakah anda ingin keluar ?'])
        reply = QtGui.QMessageBox.question(self, 'Message', "Apakah anda ingin keluar ?", QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)

        if reply == QtGui.QMessageBox.Yes:
            temp_login = library.temp_ver('','','','','','','',self)
            temp_login.logout()
            myclass = library.l_soal()
            myclass.delete_navsoal()
            myclass.delete_navnosoal()
            event.accept()
        else:
            event.ignore()
            error.sendlog(['debug','close event ignore'])
            
    def chekbox_state_type_soal_1(self):        
        if self.type_soal_pg.isChecked():
            self.type_soal_essay.setChecked(False)
            self.centralwidget3.hide()
            self.centralwidget2.show()
        else:
            self.centralwidget2.hide()
            self.centralwidget3.hide()
            pass
        
    def chekbox_state_type_soal_2(self):        
        if self.type_soal_essay.isChecked():
            self.type_soal_pg.setChecked(False)
            self.centralwidget2.hide()
            self.centralwidget3.show()
        else:
            self.centralwidget2.hide()
            self.centralwidget3.hide()
            pass
            

    def chekbox_state1(self):        
        if self.checkBox.isChecked():
            self.checkBox_2.setChecked(False)
            self.checkBox_3.setChecked(False)
            self.checkBox_4.setChecked(False)
            self.lbenar_d.hide()
            self.lbenar_e.hide()
            self.lbenar_f.hide()
            self.l_d.hide()
            self.l_e.hide()
            self.l_f.hide()
            self.j_d.hide()
            self.j_e.hide()
            self.j_f.hide()
            error.sendlog(['info','checkbox_state1 --> clicked'])
            self.widget_lbenar.setGeometry(QtCore.QRect(176, 215, 200, 41))
            self.l_benar.setGeometry(QtCore.QRect(30, 210, 145, 51))
        else:
            self.lbenar_d.hide()
            self.lbenar_e.hide()
            self.lbenar_f.hide()
            self.l_d.hide()
            self.l_e.hide()
            self.l_f.hide()
            self.j_d.hide()
            self.j_e.hide()
            self.j_f.hide()
            error.sendlog(['info','checkbox_state1 --> else:ignore'])
            self.widget_lbenar.setGeometry(QtCore.QRect(176, 215, 200, 41))
            self.l_benar.setGeometry(QtCore.QRect(30, 210, 145, 51))

    def chekbox_state2(self):
        if self.checkBox_2.isChecked():
            self.checkBox.setChecked(False)
            self.checkBox_3.setChecked(False)
            self.checkBox_4.setChecked(False)
            self.lbenar_d.show()
            self.lbenar_e.hide()
            self.lbenar_f.hide()
            self.l_d.show()
            self.l_e.hide()
            self.l_f.hide()
            self.j_d.show()
            self.j_e.hide()
            self.j_f.hide()
            error.sendlog(['info','checkbox_state2 --> clicked'])
            self.widget_lbenar.setGeometry(QtCore.QRect(176, 275, 200, 41))
            self.l_benar.setGeometry(QtCore.QRect(30, 270, 145, 51))
        else:
            self.lbenar_d.hide()
            self.lbenar_e.hide()
            self.lbenar_f.hide()
            self.l_d.hide()
            self.l_e.hide()
            self.l_f.hide()
            self.j_d.hide()
            self.j_e.hide()
            self.j_f.hide()
            error.sendlog(['info','checkbox_state2 --> else:ignore'])
            self.widget_lbenar.setGeometry(QtCore.QRect(176, 215, 200, 41))
            self.l_benar.setGeometry(QtCore.QRect(30, 210, 145, 51))

    def chekbox_state3(self):
        if self.checkBox_3.isChecked():
            self.checkBox.setChecked(False)
            self.checkBox_2.setChecked(False)
            self.checkBox_4.setChecked(False)
            self.lbenar_d.show()
            self.lbenar_e.show()
            self.lbenar_f.hide()
            self.l_d.show()
            self.l_e.show()
            self.l_f.hide()
            self.j_d.show()
            self.j_e.show()
            self.j_f.hide()
            error.sendlog(['info','checkbox_state3 --> clicked'])
            self.widget_lbenar.setGeometry(QtCore.QRect(176, 335, 200, 41))
            self.l_benar.setGeometry(QtCore.QRect(30, 330, 145, 51))
        else:
            self.lbenar_d.hide()
            self.lbenar_e.hide()
            self.lbenar_f.hide()
            self.l_d.hide()
            self.l_e.hide()
            self.l_f.hide()
            self.j_d.hide()
            self.j_e.hide()
            self.j_f.hide()
            error.sendlog(['info','checkbox_state3 --> else:ignore'])
            self.widget_lbenar.setGeometry(QtCore.QRect(176, 215, 200, 41))
            self.l_benar.setGeometry(QtCore.QRect(30, 210, 145, 51))

    def chekbox_state4(self):
        if self.checkBox_4.isChecked():
            self.checkBox.setChecked(False)
            self.checkBox_2.setChecked(False)
            self.checkBox_3.setChecked(False)
            self.lbenar_d.show()
            self.lbenar_e.show()
            self.lbenar_f.show()
            self.l_d.show()
            self.l_e.show()
            self.l_f.show()
            self.j_d.show()
            self.j_e.show()
            self.j_f.show()
            error.sendlog(['info','checkbox_state4 --> clicked'])
            self.widget_lbenar.setGeometry(QtCore.QRect(176, 395, 200, 41))
            self.l_benar.setGeometry(QtCore.QRect(30, 390, 145, 51))
        else:
            self.lbenar_d.hide()
            self.lbenar_e.hide()
            self.lbenar_f.hide()
            self.l_d.hide()
            self.l_e.hide()
            self.l_f.hide()
            self.j_d.hide()
            self.j_e.hide()
            self.j_f.hide()
            error.sendlog(['info','checkbox_state4 --> else:ignore'])
            self.widget_lbenar.setGeometry(QtCore.QRect(176, 215, 200, 41))
            self.l_benar.setGeometry(QtCore.QRect(30, 210, 145, 51))

    def win_error(self, data, addinfo=None):
        print "data = ",data
        error_win = error.elogin(data[0],data[1],self,addinfo)
        error.sendlog([data[0],data[1]])
        #win_about.setData("Just me and todut kevin raja unying and pesek")
        #win_about.setInfo("error")
        error_win.show()
        del(error_win)

    def win_conf(self):
        conf_win = view.Config_Form(self)
        conf_win.show()

    def set_jwb_benar(self):
        error.sendlog(['info','set_jwb_benar --> set jawaban benar'])
        if self.lbenar_a.isChecked():
            self.jwb_benar = "a"
        elif self.lbenar_b.isChecked():
            self.jwb_benar = "b"
        elif self.lbenar_c.isChecked():
            self.jwb_benar = "c"
        elif self.lbenar_d.isChecked():
            self.jwb_benar = "d"
        elif self.lbenar_e.isChecked:
            self.jwb_benar = "e"
        elif self.lbenar_f.isChecked():
            self.jwb_benar = "f"
        else:
            pass

    def addsoal(self):
        try:
            Q = str(self.t_edit.toPlainText())
            A = self.jwb_benar
            op = str(self.j_a.toPlainText()),str(self.j_b.toPlainText()), str(self.j_c.toPlainText()), str(self.j_d.toPlainText()), str(self.j_e.toPlainText()), str(self.j_f.toPlainText())
            print "Q = ", Q
            print "A = ", A
            print "OP = ", op
            temp_soal = library.l_soal()
            #temp_soal.delete_navsoal()
            maxid = temp_soal.getmax_id()
            if(Q == None or Q == "" or Q == " "):
                self.win_error(('warning','\nsoal yang anda masukkan belum lengkap 1 !\n\n'), "data Q = " + str(Q))
                error.sendlog(['warning','addsoal --> soal yang anda masukkan belum lengkap 1 !' +  "data Q = " + str(Q)])
            elif(A == None or A == "" or A == " "):
                self.win_error(('warning','\nsoal yang anda masukkan belum lengkap 2 !\n\n'), "data A = " + str(A))
                error.sendlog(['warning','addsoal --> soal yang anda masukkan belum lengkap 2 !' +  "data Q = " + str(A)])
            else:
                #print "Q = ", Q
                #print "A = ", A
                #print "OP = ", op
                if(temp_soal.addsoal(Q,A,op)[0] == True):
                    self.clear_form()
                else:
                    self.win_error(('error','\n script error ! \n\n'),str(temp_soal.addsoal(Q,A,op)[1]))
                    error.sendlog(['error','addsoal --> script error !' + str(temp_soal.addsoal(Q,A,op)[1])])
            self.c_nosoal.clear()
            self.c_nosoal.addItems(self.getallid('pg'))
            return True
        except:
            data_e = traceback.format_exc()
            self.win_error(('error','\nscript error occurs !\n\n'), str(data_e))
            error.sendlog(['error','addsoal --> script error occurs ! error: ' + str(data_e)])
            return False

    def addsoal2(self):
        try:
            essay = str(self.j_essay.toPlainText())
            jwb_essay = str(self.j_jessay.toPlainText())
            temp_soal = library.l_soal()
            temp_soal.delete_navsoal()
            maxid = temp_soal.getmax_id()
            if(essay == None or essay == "" or essay == " "):
                self.win_error(('warning','\nsoal yang anda masukkan belum lengkap !\n\n'), "data Q = " + str(essay))
                error.sendlog(['warning','addsoal --> soal yang anda masukkan belum lengkap !' +  "data Q = " + str(essay)])
            elif(jwb_essay == None or jwb_essay == "" or jwb_essay == " "):
                self.win_error(('warning','\nsoal yang anda masukkan belum lengkap !\n\n'), "data A = " + str(jwb_essay))
                error.sendlog(['warning','addsoal --> soal yang anda masukkan belum lengkap !' +  "data Q = " + str(jwb_essay)])
            else:
                if(temp_soal.addsoal2(essay,jwb_essay)[0] == True):
                    self.clear_form()
                else:
                    self.win_error(('error','\n script error ! \n\n'),str(temp_soal.addsoal2(essay,jwb_essay)[1]))
                    error.sendlog(['error','addsoal --> script error !' + str(temp_soal.addsoal2(essay,jwb_essay)[1])])
            self.c_nosoal.clear()
            self.c_nosoal.addItems(self.getallid('essay'))
            return True
        except:
            data_e = traceback.format_exc()
            self.win_error(('error','\nscript error occurs !\n\n'), str(data_e))
            error.sendlog(['error','addsoal --> script error occurs ! error: ' + str(data_e)])
            return False

    def getallid(self,soal_type):
        error.sendlog(['info','getallid --> get id from library -> l_soal'])
        myclass = library.l_soal()
        data = myclass.get_id(soal_type)
        return data

    def getsoalby_id(self, idx):
        try:
            self.edit_bt.show()
            self.back_bt.show()
            self.next_bt.show()
            myclass = library.l_soal()
            data = myclass.getby_id(int(idx))[0]
            data_soal = myclass.split_data('soal',idx)
            self.t_edit.setText(str(data[1]))
            self.j_a.setPlainText(str(data_soal[0][-1][0]))
            self.j_b.setPlainText(str(data_soal[0][-1][1]))
            self.j_c.setPlainText(str(data_soal[0][-1][2]))
            self.j_d.setPlainText(str(data_soal[0][-1][3]))
            self.j_e.setPlainText(str(data_soal[0][-1][4]))
            self.j_f.setPlainText(str(data_soal[0][-1][5]))
            self.disable_edit()

            maxid = myclass.getmax_id()
            minid = maxid - 1
            myclass.setsoalmaxmin(maxid,minid)
        except:
            datae = traceback.format_exc()
            self.win_error(('error','error script !'),str(datae))
            print "v_soal - getsoalby_id --> error"
            error.sendlog(['error','v_soal - getsoalby_id --> error:'+str(datae)])

    def getsoalby_id2(self):
        try:
            self.edit_bt.show()
            self.back_bt.show()
            self.next_bt.show()
            myclass = library.l_soal()
            data = myclass.getby_id(int(self.c_nosoal.currentText()))[0]
            data_soal = myclass.split_data('soal',int(self.c_nosoal.currentText()))
            self.t_edit.setText(str(data[1]))
            self.j_a.setPlainText(str(data_soal[0][-1][0]))
            self.j_b.setPlainText(str(data_soal[0][-1][1]))
            self.j_c.setPlainText(str(data_soal[0][-1][2]))
            self.j_d.setPlainText(str(data_soal[0][-1][3]))
            self.j_e.setPlainText(str(data_soal[0][-1][4]))
            self.j_f.setPlainText(str(data_soal[0][-1][5]))
            self.disable_edit()

            data_check = myclass.getsoalmaxmin()
            if len(data_check) > 1:
                print "v_soal - getsoalby_id2 --> len(data_check) > 1"
                error.sendlog(['info', "v_soal - getsoalby_id2 --> len(data_check) > 1"])
                maxid = int(self.c_nosoal.currentText()) - 1
                minid = maxid - 2
                myclass.delete_navsoal()
                myclass.setsoalmaxmin(maxid,minid)
                #self.comboControll = True
            else:
                print "v_soal - getsoalby_id2 - len(data_check) > 1 --> else"
                error.sendlog(['info','v_soal - getsoalby_id2 - len(data_check) > 1 --> else'])
                maxid = int(self.c_nosoal.currentText()) + 1
                minid = maxid 
                myclass.delete_navsoal()
                #myclass.updatesoalmaxmin(maxid,minid,int(self.c_nosoal.currentText()))
                myclass.setsoalmaxmin(maxid,minid)
                #self.comboControll = True
        except:
            datae = traceback.format_exc()
            #self.win_error(('error','data not found !'),str(datae))
            print "v_soal - getsoalby_id2 --> error"
            print "v_soal - traceback --> ", str(datae)
            error.sendlog(['error',"v_soal - traceback --> error: " + str(datae)])
            pass

    def pre_getsoalby_id2(self):
        self.getsoalby_id2()
        self.comboControll = False
        self.backControll = True
        print "v_soal - pre_getsoalby_id2 --> comboControll = ", self.comboControll
        error.sendlog(['info',"v_soal - pre_getsoalby_id2 --> comboControll = " + str(self.comboControll)])

    def updatesoal(self):
        try:
            myclass = library.l_soal()
            my_number = myclass.getsoalmaxmin()
            max_number = my_number[1][0][0]
            #if max_number == 0:
            condition = " WHERE id = " + str(int(max_number) + 1)
            #else:
            #    condition = " WHERE id = " + str(max_number)
            Q = str(self.t_edit.toPlainText())
            A = self.jwb_benar
            op = str(self.j_a.toPlainText()),str(self.j_b.toPlainText()), str(self.j_c.toPlainText()), str(self.j_d.toPlainText()), str(self.j_e.toPlainText()), str(self.j_f.toPlainText())
            data = []
            data.append("soal = '" + Q + "'")
            data.append("jawaban = '" + A + "'")
            data.append("pilihan = \"" + str(op) + "\"")

            soal = library.l_soal()
            soal.update(data, condition)
            self.disable_edit()
            self.cancel_bt.hide()
            self.save_bt.hide()
            self.back_bt.show()
            self.next_bt.show()
        except:
            datae = traceback.format_exc()
            self.win_error(('error','error script occurs'),str(datae))
            error.sendlog(['error','updatesoal -- > error script occurs error: ' + str(datae)])

    def next_process_gateway(self):
        try:
            myclass = library.l_soal()
            maxid = myclass.getmax_id()
            minid = maxid - 1
            #myclass.setsoalmaxmin(maxid,minid)
            my_number = myclass.getsoalmaxmin()[1]
            print "v_soal - next_process_gateway  --> my_number =  ", my_number, "len = ", len(my_number)
            error.sendlog(['info',"v_soal - next_process_gateway  --> my_number =  " + str( my_number) + "; len = " + str(len(my_number))])
            #if len(my_number) < 1:
                #print "v_soal - next_process_gateway --> addsoal()"
                #self.addsoal()
                #error.sendlog(['debug',"v_soal - next_process_gateway --> addsoal()"])
            #else:
            print "v_soal - next_process_gateway --> next_process()"
                #print "v_soal - next_process_gateway --> my_number = ", my_number
                #print "v_soal - next_process_gateway --> my_number[0] = ", my_number[0]
                #print "v_soal - next_process_gateway --> my_number[0][0] = ", my_number[0][0]
                #print "v_soal - next_process_gateway --> my_number[0][1] = ", my_number[0][1]
            self.next_process()
            error.sendlog(['debug',"v_soal - next_process_gateway --> next_process()"])
        except:
            datae = traceback.format_exc()
            self.win_error(('error','error script occurs'),str(datae))
            error.sendlog(['error','error script occurs! error: ' + str(datae)])

    def next_process(self):
        try:
            myclass = library.l_soal()
            maxid = myclass.getmax_id()
            my_number = myclass.getsoalmaxmin() 
            print "v_soal - next_process --> my number = ", my_number
            error.sendlog(['info',"v_soal - next_process --> my number = " +  str(my_number)])
            if my_number[0] == True:
                max_number = my_number[1][0][0]
                min_number = my_number[1][0][1]
                print "v_soal - next_process --> max number = ", max_number
                error.sendlog(['info',"v_soal - next_process --> max number = " +  str(max_number)])
                print "v_soal - next_process --> min number = ", min_number
                error.sendlog(['info',"v_soal - next_process --> min number = " +  str(min_number)])
                mynext = int(maxid) - 1
                if max_number == 0:
                    myclass.setsoalmaxmin(1,0)
                elif max_number == None:
                    myclass.setsoalmaxmin(1,0)
                else:
                    pass
                if max_number == maxid :
                    print "v_soal - next_process --> max_number == maxid"
                    error.sendlog(['info',"v_soal - next_process --> max_number == maxid"])
                    self.edit_bt.hide()
                    if len(str(self.t_edit.toPlainText())) > 1 or len(str(self.lbenar_a.text())) > 1 or len(str(self.lbenar_b)) > 1 or len(str(self.lbenar_c)) > 1:
                        print "v_soal - next_process --> max_number == maxid --> addsoal()"
                        error.sendlog(['debug',"v_soal - next_process --> max_number == maxid --> addsoal()"])
                        print "v_soal - next_process  --> comboControll = ", self.comboControll
                        error.sendlog(['info', "v_soal - next_process  --> comboControll = " + str(self.comboControll)])
                        if self.comboControll == True:
                            self.addsoal()
                            self.backControll = False
                        else:
                            if max_number == maxid:
                                self.addsoal()
                                self.backControll = False
                            else:
                                pass
                        self.comboControll = True
                        print "v_soal - next_process  --> comboControll = ", self.comboControll
                        error.sendlog(['info',"v_soal - next_process  --> comboControll = " + str(self.comboControll)])
                        self.enable_edit()
                        self.save_bt.hide()
                        self.cancel_bt.hide()
                        self.back_bt.show()
                        self.next_bt.show()
                        self.t_edit.clear()
                        self.j_a.clear()
                        self.j_b.clear()
                        self.j_c.clear()
                        self.j_d.clear()
                        self.j_e.clear()
                        self.j_f.clear()
                        self.lbenar_a.setChecked(False)
                        self.lbenar_b.setChecked(False)
                        self.lbenar_c.setChecked(False)
                        self.lbenar_d.setChecked(False)
                        self.lbenar_e.setChecked(False)
                        self.lbenar_f.setChecked(False)
                        self.c_nosoal.clear()
                        self.c_nosoal.addItems(self.getallid('pg'))
                    else:
                        print "v_soal - next_process --> max_number == maxid --> pass:clear"
                        error.sendlog(['info',"v_soal - next_process --> max_number == maxid --> pass:clear"])
                        self.enable_edit()
                        self.save_bt.hide()
                        self.cancel_bt.hide()
                        self.back_bt.show()
                        self.next_bt.show()
                        self.t_edit.clear()
                        self.j_a.clear()
                        self.j_b.clear()
                        self.j_c.clear()
                        self.j_d.clear()
                        self.j_e.clear()
                        self.j_f.clear()
                        self.lbenar_a.setChecked(False)
                        self.lbenar_b.setChecked(False)
                        self.lbenar_c.setChecked(False)
                        self.lbenar_d.setChecked(False)
                        self.lbenar_e.setChecked(False)
                        self.lbenar_f.setChecked(False)
                        self.c_nosoal.clear()
                        self.c_nosoal.addItems(self.getallid('pg'))
                        setmax = int(max_number) + 1
                        setmin = int(max_number)
                        myclass.updatesoalmaxmin(setmax, setmin, max_number)

                elif max_number > maxid:
                    print "v_soal - next_process --> max_number > maxid"                    
                    error.sendlog(['info',"v_soal - next_process --> max_number > maxid"])
                    #nosoal = myclass.getnosoalmaxmin()
                    #myclass.setnosoalmaxmin(int(nosoal[1][0][0]) + 1, int(nosoal[1][0][1]) + 1)
                    #self.c_nosoal.clear()
                    #self.c_nosoal.addItem(nosoal[1][0][0])           
                    print "v_soal - next_process - max_number > maxid --> add soal"
                    error.sendlog(['info',"v_soal - next_process - max_number > maxid --> add soal"])
                    if self.comboControll == True:
                        if(self.addsoal()) == True:
                            try:
                                self.getsoalby_id(int(max_number) + 2)
                                self.t_edit.clear()
                                self.j_a.clear()
                                self.j_b.clear()
                                self.j_c.clear()
                                self.j_d.clear()
                                self.j_e.clear()
                                self.j_f.clear()
                                self.c_nosoal.clear()
                                self.c_nosoal.addItems(self.getallid('pg'))
                                self.comboControll = False
                                self.backControll = False
                                print "v_soal - next_process - max_number > maxid --> clear 1"   
                                error.sendlog(['info',"v_soal - next_process - max_number > maxid --> clear 1"])
                                print  "v_soal - next_process - max_number > maxid -->comboControl = ", self.comboControll
                                error.sendlog(['info',"v_soal - next_process - max_number > maxid -->comboControl = " + str(self.comboControll)])
                            except:
                                self.getsoalby_id(int(max_number) )
                                self.t_edit.clear()
                                self.j_a.clear()
                                self.j_b.clear()
                                self.j_c.clear()
                                self.j_d.clear()
                                self.j_e.clear()
                                self.j_f.clear()
                                self.c_nosoal.clear()
                                self.c_nosoal.addItems(self.getallid('pg'))
                                #self.comboControll = False
                                print "v_soal - next_process - max_number > maxid --> clear 2"   
                                error.sendlog(['info',"v_soal - next_process - max_number > maxid --> clear 2"])
                                print  "v_soal - next_process - max_number > maxid -->comboControl = ", self.comboControll
                                error.sendlog(['info',"v_soal - next_process - max_number > maxid -->comboControl = " +  str(self.comboControll)])
                    else:
                        #self.comboControll = True
                        print "v_soal - next_process -> max_number > maxid -- > comboControl = ", self.comboControll 
                        error.sendlog(['info',"v_soal - next_process -> max_number > maxid -- > comboControl = " + str(self.comboControll)])
                    self.enable_edit()
                    self.save_bt.hide()
                    self.cancel_bt.hide()
                    self.back_bt.show()
                    self.next_bt.show()

                else:
                    try:
                        if max_number == 0:
                            print "v_soal - next_process --> else:max_number == 0"
                            error.sendlog(['info',"v_soal - next_process --> else:max_number == 0"])
                            data = myclass.getby_id(2)
                            myclass.delete_navsoal()
                            myclass.setsoalmaxmin(1,2)
                            maxnumber = 2
                            jwb = myclass.split_data('soal',2)[0][3]
                            jwb_benar = myclass.split_data('soal',2)[0][2]
                            #if max_number == 0:
                            #    self.c_nosoal.setCurrentIndex(2)
                            #else:
                            #    self.c_nosoal.setCurrentIndex(int(max_number) )
                            self.c_nosoal.setCurrentIndex(1)
                            self.backControll = True
                        elif max_number == None:
                            print "v_soal - next_process --> else:max_number == None"
                            error.sendlog(['info',"v_soal - next_process --> else:max_number == None"])
                            data = myclass.getby_id(2)
                            myclass.delete_navsoal()
                            myclass.setsoalmaxmin(2,1)
                            maxnumber = 2
                            jwb = myclass.split_data('soal',maxnumber)[0][3]
                            jwb_benar = myclass.split_data('soal',maxnumber)[0][2]
                            self.backControll = True
                            #if max_number == 0:
                            #    self.c_nosoal.setCurrentIndex(2)
                            #else:
                            #    self.c_nosoal.setCurrentIndex(int(max_number) )
                            self.c_nosoal.setCurrentIndex(1)
                        else:
                            print "v_soal - next_process --> get next data"
                            error.sendlog(['info',"v_soal - next_process --> get next data"])
                            print "v_soal - next_process - get next data --> max_number = ", max_number
                            error.sendlog(['info',"v_soal - next_process - get next data --> max_number = " +  str(max_number)])
                            setmax = int(max_number) + 1
                            setmin = int(max_number)
                            print "v_soal - next_process - get next data --> setmax = ",setmax
                            error.sendlog(['info',"v_soal - next_process - get next data --> setmax = " + str(setmax)])
                            myclass.updatesoalmaxmin(setmax, setmin, max_number)
                            my_number = myclass.getsoalmaxmin()
                            max_number = my_number[1][0][0]
                            min_number = my_number[1][0][1]
                            if max_number < setmax:
                                print "v_soal - next_process - get next data --> max_number < setmax"
                                error.sendlog(['info',"v_soal - next_process - get next data --> max_number < setmax"])
                                data = myclass.getby_id(setmax)
                                jwb = myclass.split_data('soal',int(setmax) + 1)[0][3]
                                jwb_benar = myclass.split_data('soal',int(setmax) + 1)[0][2]
                            if max_number == setmax:
                                if maxid == max_number:
                                    print "v_soal - next_process - get next data --> max_number == maxid"
                                    error.sendlog(['info',"v_soal - next_process - get next data --> max_number == maxid"])
                                    data = [('','')]
                                    jwb = ['','','','','','']
                                    jwb_benar = ''
                                    self.enable_edit()
                                    self.backControll = False
                                else:
                                    print "v_soal - next_process - get next data --> max_number == setmax --> get next data"
                                    error.sendlog(['info',"v_soal - next_process - get next data --> max_number == setmax --> get next data"])
                                    data = myclass.getby_id(max_number + 1)
                                    jwb = myclass.split_data('soal',max_number + 1)[0][3]
                                    jwb_benar = myclass.split_data('soal',max_number + 1)[0][2]
                                    self.disable_edit()
                                    self.save_bt.hide()
                                    self.cancel_bt.hide()
                                    self.back_bt.show()
                                    self.next_bt.show()

                            else:
                                print "v_soal - next_process - get next data --> else2 "
                                error.sendlog(['info',"v_soal - next_process - get next data --> else2 "])
                                data = myclass.getby_id(setmax)
                                jwb = myclass.split_data('soal',setmax)[0][3]
                                jwb_benar = myclass.split_data('soal',setmax)[0][2]

                            if max_number == 0:
                                self.c_nosoal.setCurrentIndex(1)
                            else:
                                self.c_nosoal.setCurrentIndex(int(max_number) )

                        if len(data) > 1:
                            print "v_soal - next_process - get next data --> len(data) > 1 "
                            error.sendlog(['info',"v_soal - next_process - get next data --> len(data) > 1 "])
                            print "v_soal - next_process - get next data --> comboControll =  ", self.comboControll
                            error.sendlog(['info',"v_soal - next_process - get next data --> comboControll =  " +  str(self.comboControll)])
                            self.t_edit.setText(data[0][1])
                            self.j_a.setText(str(jwb[0]))
                            self.j_b.setText(str(jwb[1]))
                            self.j_c.setText(str(jwb[2]))
                            self.j_d.setText(str(jwb[3]))
                            self.j_e.setText(str(jwb[4]))
                            self.j_f.setText(str(jwb[5]))
                            self.set_jwb_from(jwb_benar)
                            #self.enable_edit()
                            self.cancel_bt.hide()
                            self.save_bt.hide()
                            self.back_bt.show()
                            self.next_bt.show()
                            self.c_nosoal.clear()
                            self.c_nosoal.addItems(self.getallid('pg'))
                        else:
                            print "v_soal - next_process - get next data - len(data) > 1 --> else "
                            error.sendlog(['info',"v_soal - next_process - get next data - len(data) > 1 --> else "])
                            print "v_soal - next_process - get next data --> comboControll =  ", self.comboControll
                            error.sendlog(['info',"v_soal - next_process - get next data --> comboControll =  " + str(self.comboControll)])
                            try:
                                if self.backControll == True:
                                    self.disable_edit()
                                else:
                                    self.enable_edit()
                                    self.edit_bt.hide()
                                self.save_bt.hide()
                                self.cancel_bt.hide()
                                self.back_bt.show()
                                self.next_bt.show()
                                self.t_edit.setText(data[0][1])
                                self.j_a.setText(str(jwb[0]))
                                self.j_b.setText(str(jwb[1]))
                                self.j_c.setText(str(jwb[2]))
                                self.j_d.setText(str(jwb[3]))
                                self.j_e.setText(str(jwb[4]))
                                self.j_f.setText(str(jwb[5]))
                                self.set_jwb_from(jwb_benar)
                            except:
                                self.t_edit.clear()
                                self.j_a.clear()
                                self.j_b.clear()
                                self.j_c.clear()
                                self.j_d.clear()
                                self.j_e.clear()
                                self.j_f.clear()
                                self.lbenar_a.setChecked(False)
                                self.lbenar_b.setChecked(False)
                                self.lbenar_c.setChecked(False)
                                self.lbenar_d.setChecked(False)
                                self.lbenar_e.setChecked(False)
                                self.lbenar_f.setChecked(False)
                                self.c_nosoal.clear()
                                self.c_nosoal.addItems(self.getallid('pg'))
                                error.sendlog(['info',"v_soal - next_process - get next data - len(data) > 1 --> else -> except "])
                    except:
                        data_e = traceback.format_exc()
                        self.win_error(('error','\ndata tidak ditemukan !'), str(data_e))
                        error.sendlog(['error','next_process --> else -> data tidak ditemukan ! -> error: ' + str(data_e)])

                return True        
        except:
            data_e = traceback.format_exc()
            self.win_error(('error','\nscript error occurs !'), str(data_e))
            error.sendlog(['error','next_process --> script error occurs ! error: ' + str(data_e)])

    def setfont(self,obj,font='Arial',size=12,bold=400):
        obj.setFont(QtGui.QFont(str(font),int(size),int(bold)))

    def set_jwb_from(self,data):
        if data == 'a':
            self.lbenar_a.setChecked(True)
        elif data == 'b':
            self.lbenar_b.setChecked(True)
        elif data == 'c':
            self.lbenar_c.setChecked(True)
        elif data == 'd':
            self.lbenar_d.setChecked(True)
        elif data == 'e':
            self.lbenar_e.setChecked(True)
        elif data == 'f':
            self.lbenar_f.setChecked(True)
        error.sendlog(['info','set_jwb_from --> set jawaban'])

    def enable_edit(self):
        self.back_bt.hide()
        self.next_bt.hide()
        self.save_bt.show()
        self.cancel_bt.show()
        self.t_edit.setEnabled(True)
        self.j_a.setEnabled(True)
        self.j_b.setEnabled(True)
        self.j_c.setEnabled(True)
        self.j_d.setEnabled(True)
        self.j_e.setEnabled(True)
        self.j_f.setEnabled(True)
        self.checkBox.setEnabled(True)
        self.checkBox_2.setEnabled(True)
        self.checkBox_3.setEnabled(True)
        self.checkBox_4.setEnabled(True)

        self.lbenar_a.setEnabled(True)
        self.lbenar_b.setEnabled(True)
        self.lbenar_c.setEnabled(True)
        self.lbenar_d.setEnabled(True)
        self.lbenar_e.setEnabled(True)
        self.lbenar_f.setEnabled(True)

        self.setfont(self.t_edit)
        self.setfont(self.j_a)
        self.setfont(self.j_b)
        self.setfont(self.j_c)
        self.setfont(self.j_d)
        self.setfont(self.j_e)
        self.setfont(self.j_f)

        error.sendlog(['info','enable_edit --> TRUE'])

    def disable_edit(self):
        self.t_edit.setDisabled(True)
        self.setfont(self.t_edit,bold=600)
        self.j_a.setDisabled(True)
        self.setfont(self.j_a,bold=600)
        self.j_b.setDisabled(True)
        self.setfont(self.j_b,bold=600)
        self.j_c.setDisabled(True)
        self.setfont(self.j_c,bold=600)
        self.j_d.setDisabled(True)
        self.setfont(self.j_d,bold=600)
        self.j_e.setDisabled(True)
        self.setfont(self.j_e,bold=600)
        self.j_f.setDisabled(True)
        self.setfont(self.j_f,bold=600)

        self.checkBox.setDisabled(True)
        self.checkBox_2.setDisabled(True)
        self.checkBox_3.setDisabled(True)
        self.checkBox_4.setDisabled(True)

        self.lbenar_a.setDisabled(True)
        self.lbenar_b.setDisabled(True)
        self.lbenar_c.setDisabled(True)
        self.lbenar_d.setDisabled(True)
        self.lbenar_e.setDisabled(True)
        self.lbenar_f.setDisabled(True)

        error.sendlog(['info','disable_edit --> TRUE'])

    def cancel_edit(self):
        self.save_bt.hide()
        self.cancel_bt.hide()
        self.next_bt.show()
        self.back_bt.show()
        self.disable_edit()
        error.sendlog(['info','cancel_edit --> disable_edit -> FALSE'])
        error.sendlog(['info','cancel_edit --> return'])
        return
    def back_process(self):
        error.sendlog(['info','back_process --> run'])
        try:
            self.c_nosoal.addItems(self.getallid('pg'))
            self.edit_bt.show()
            self.disable_edit()
            myclass = library.l_soal()
            maxid = myclass.getmax_id()
            minid = maxid - 1
            myclass.setsoalmaxmin(maxid,minid)
            my_number = myclass.getsoalmaxmin()
            #print "my number = ", my_number
            #print "my number[1] = ", my_number[1]
            #print "my number[1][0] = ", my_number[1][0]
            #print "my number[1][0][0] = ", my_number[1][0][0]
            #print "my number[1][0][1] = ", my_number[1][0][1]

            if my_number[0] == True:
                max_number = my_number[1][0][0]
                min_number = my_number[1][0][1]
                #print "max number = ", max_number
                #print "min number = ", min_number

                if max_number == 0 or max_number == None:
                    print "v_soal - back_process --> max_number == 0 or max_number == None"
                    error.sendlog(['debug',"v_soal - back_process --> max_number == 0 or max_number == None"])
                    self.show_login()
                    self.hide()
                elif my_number == int(maxid) + 1:
                    print "v_soal - back_process --> my_number == int(maxid) + 1"
                    error.sendlog(['info',"v_soal - back_process --> my_number == int(maxid) + 1"])
                    try:
                        maxnumber = int(my_number) - 1
                        my_id = int(maxid) - 1
                        data = myclass.getby_id(maxnumber)
                        jwb = myclass.split_data('soal',maxnumber)[0][3]
                        jwb_benar = myclass.split_data('soal',maxnumber)[0][2]
                        #print "JAWABAN BACK = ", jwb
                        #print "JAWABAN BACK[0] = ", jwb[0]
                        #print "DATA BACK = ", data[0]
                        self.c_nosoal.setCurrentIndex(int(max_number) )
                        self.t_edit.setText(data[0][1])
                        self.j_a.setText(str(jwb[0]))
                        self.j_b.setText(str(jwb[1]))
                        self.j_c.setText(str(jwb[2]))
                        self.j_d.setText(str(jwb[3]))
                        self.j_e.setText(str(jwb[4]))
                        self.j_f.setText(str(jwb[5]))
                        #print "JAWABAN BENAR = ", jwb_benar
                        self.set_jwb_from(jwb_benar)
                        self.c_nosoal.clear()
                        self.c_nosoal.addItems(self.getallid('pg'))
                        self.c_nosoal.setCurrentIndex(int(maxnumber))

                    except:
                        data_e = traceback.format_exc()
                        self.win_error(('error','\ndata tidak ditemukan !'), str(data_e))
                        error.sendlog(['error','back_process --> data tidak ditemukan ! error: ' + str(data_e)])
                        print "v_soal - back_process - my_number == int(maxid) + 1 --> error = ", data_e
                        error.sendlog(['error',"v_soal - back_process - my_number == int(maxid) + 1 --> error = " +  str(data_e)])

                    #myclass.delete_navsoal()
                    setmax = int(maxnumber) 
                    setmin = int(maxnumber) - 1
                    myclass.updatesoalmaxmin(setmax, setmin,my_number)
                else:
                    try:
                        if max_number > maxid:
                            print "v_soal - back_process --> max_number > maxid"
                            error.sendlog(['info',"v_soal - back_process --> max_number > maxid"])
                            setmax = int(max_number) -2 
                            setmin = int(max_number) - 3
                            myclass.updatesoalmaxmin(setmax, setmin,max_number)
                            #print "AHAHAHAHAHAHA"
                            #print "max number A = ", max_number
                            my_id = int(maxid) - 1
                            data = myclass.getby_id(int(max_number)-1)
                            jwb = myclass.split_data('soal',int(max_number)-1)[0][3]
                            jwb_benar = myclass.split_data('soal',int(max_number)-1)[0][2]
                            #print "JAWABAN BACK = ", jwb
                            #print "JAWABAN BACK[0] = ", jwb[0]
                            #print "DATA BACK = ", data[0]
                            self.t_edit.setText(data[0][1])
                            self.j_a.setText(str(jwb[0]))
                            self.j_b.setText(str(jwb[1]))
                            self.j_c.setText(str(jwb[2]))
                            self.j_d.setText(str(jwb[3]))
                            self.j_e.setText(str(jwb[4]))
                            self.j_f.setText(str(jwb[5]))
                            #print "JAWABAN BENAR = ", jwb_benar
                            self.set_jwb_from(jwb_benar)
                            self.c_nosoal.clear()
                            self.c_nosoal.addItems(self.getallid('pg'))
                            self.c_nosoal.setCurrentIndex(int(max_number)  - 1)
                            return
                        else:
                            print "v_soal - back_process - max_number > maxid --> else"
                            error.sendlog(['info',"v_soal - back_process - max_number > maxid --> else"])
                            #maxnumber = max_number
                            my_id = int(maxid) - 1
                            data = myclass.getby_id(max_number)
                            jwb = myclass.split_data('soal',max_number)[0][3]
                            jwb_benar = myclass.split_data('soal',max_number)[0][2]
                        # print "JAWABAN BACK = ", jwb
                            #print "JAWABAN BACK[0] = ", jwb[0]
                            #print "DATA BACK = ", data[0]
                            self.t_edit.setText(data[0][1])
                            self.j_a.setText(str(jwb[0]))
                            self.j_b.setText(str(jwb[1]))
                            self.j_c.setText(str(jwb[2]))
                            self.j_d.setText(str(jwb[3]))
                            self.j_e.setText(str(jwb[4]))
                            self.j_f.setText(str(jwb[5]))
                            #print "JAWABAN BENAR = ", jwb_benar
                            self.set_jwb_from(jwb_benar)
                            self.c_nosoal.clear()
                            self.c_nosoal.addItems(self.getallid('pg'))
                            self.c_nosoal.setCurrentIndex(int(max_number) - 1)

                    except:
                        data_e = traceback.format_exc()
                        self.win_error(('error','\ndata tidak ditemukan !'), str(data_e))
                        error.sendlog(['error','back_process --> data tidak ditemukan ! error: ' + str(data_e)])
                        print "v_soal - back_process --> else:error = ", data_e
                        error.sendlog(['error',"v_soal - back_process --> else:error = " + str(data_e)])

                myclass.delete_navsoal()
                setmax = int(max_number) - 1
                setmin = int(setmax) - 1
                myclass.setsoalmaxmin(setmax, setmin)

        except:
            data_e = traceback.format_exc()
            self.win_error(('error','\nscript error occurs !'), str(data_e))
            error.sendlog(['error','back_process --> script error occurs ! error: ' + str(data_e)])

    def test_back_count(self):
        data = 1
        #if self.back_bt.clicked() == True:
        #    data = data + 1
        #    print data
        data = data + 1
        print data

    def show_login(self):
        login_win = v_login.MainWindows(self)
        login_win.show()
        self.hide()

    def clear_form(self):
        self.t_edit.clear()
        self.j_a.clear()
        self.j_b.clear()
        self.j_c.clear()
        self.j_d.clear()
        self.j_e.clear()
        self.j_f.clear()
        self.lbenar_a.setChecked(False)
        self.lbenar_b.setChecked(False)
        self.lbenar_c.setChecked(False)
        self.lbenar_d.setChecked(False)
        self.lbenar_e.setChecked(False)
        self.lbenar_f.setChecked(False)
        #self.checkBox.setChecked(False)
        #self.checkBox_2.setChecked(False)
        #self.checkBox_3.setChecked(False)
        #self.checkBox_4.setChecked(False)
        error.sendlog(['debug','clear_form --> TRUE'])

    def quit(self):
        error.sendlog(['debug','quit --> system will be quit'])
        self.close()      

    def keyPressEvent(self, event):
        if event.key() == QtCore.Qt.Key_Enter:
            self.addsoal()

###########################################################
"""def main():
    app = library.temp_ver() 
    if list(app.getall()) == []:
        v_login.main()
    else: 
        if app.cekcookies(app.name, app.passwd) == True:
            import sys
            app = QtGui.QApplication(sys.argv)
            MainWindow = QtGui.QMainWindow()
            ui = Ui_MainWindow()
            ui.setupUi(MainWindow)
            MainWindow.show()
            sys.exit(app.exec_())
"""            